import request from '@/utils/system/request'

// 获取数据api
export function getData(data: object) {
	return request({
		url: `/sys/dict/list`,
		method: 'post',
		data
	})
}

// 获取字典详情数据api
export function getDetailData(dictId: string) {
	return request({
		url: `/sys/dict/detail/${dictId}`,
		method: 'get',
	})
}

// 添加字典
export function add(data: object) {
	return request({
		url: `/sys/dict`,
		method: 'post',
		data
	})
}

// 添加字典
export function addDetail(data: object) {
	return request({
		url: `/sys/dict/detail`,
		method: 'post',
		data
	})
}

// 删除字典详情
export function del(data: object) {
	return request({
		url: `/sys/dict`,
		method: 'delete',
		data
	})
}

// 删除字典详情
export function delDetail(data: object) {
	return request({
		url: `/sys/dict/detail`,
		method: 'delete',
		data
	})
}

// 获取字典
export function dict(name: string) {
	return request({
		url: `/sys/dict/${name}`,
		method: 'get',
	})
}

// 编辑字典
export function update(data: object) {
	return request({
		url: `/sys/dict`,
		method: 'put',
		data
	})
}

// 编辑字典详情
export function updateDetail(data: object) {
	return request({
		url: `/sys/dict/detail`,
		method: 'put',
		data
	})
}